<?php
    header("content-type:text/html;charset=utf-8");
    $n = $_POST['n'];  //数据类型
    $v = $_POST['v'];  //数据值
    
    switch ($n) {
        case 'uname':
            $pattern = "/\w/";
            $name = '用户名';
            break;
        case 'email':
            $pattern = "/^\w+(\.\w+)*@\w+(\.\w+)+$/";
            $name = '邮箱';
            break;
    }
    if($n == 'nicname'){
        exit;
    }
    if($n == 'sex'){
        exit;
    }
    if(!preg_match($pattern,$v)){
        echo $name.'不符合数据类型';
    }
?>